<?php
$dirname = '.';
if(isset($_GET['path']) && !empty($_GET['path']))
	$dirname .= '/'.$_GET['path'];

$dir = opendir($dirname); 

$res = array();

while($file = readdir($dir)) {
	if($file == '..' || substr($file, 0, 1)== '.')
		continue;

	if(is_file($dirname.'/'.$file))
	{
		$res[] = array("title"=>$file); 
	}
	else{
		$res[] = array("title"=>$file, "isFolder"=>true, "isLazy"=>true);
	}
}

echo json_encode($res);

closedir($dir);
